﻿Public Class frmHangHoa

    Private Sub frmHangHoa_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        QuanlyHangHoa1_SukienLoad()
    End Sub
    Private Function QuanlyHangHoa1_SukienCapNhat(ByVal mHang As System.String, ByVal tenhang As System.Object, ByVal quycach As System.Object, ByVal giaban As System.Object, ByVal soluong As System.Object) As System.Int32 Handles QuanlyHangHoa1.SukienCapNhat
        Dim flag As Integer = 1
        Dim err As String = String.Empty
        err = BUS.BusHanghoa.Capnhat(mHang, tenhang, quycach, giaban, soluong)
        If (err <> String.Empty) Then
            flag = 0
            MessageBox.Show(err)
        End If
        Return flag

    End Function

    Private Sub QuanlyHangHoa1_SukienLoad() Handles QuanlyHangHoa1.SukienLoad
        Dim bang As DataTable = Nothing
        bang = BUS.BusHanghoa.Lay()
        QuanlyHangHoa1.DataSource(bang)
    End Sub

    Private Function QuanlyHangHoa1_SukienXoa(ByVal mHang As System.String) As System.Int32 Handles QuanlyHangHoa1.SukienXoa
        Dim flag As Integer = 1
        Dim err As String = String.Empty
        err = BUS.BusHanghoa.Xoa(mHang)
        If err <> String.Empty Then
            flag = 0
            MessageBox.Show(err)
        End If
        Return flag
    End Function

    Private Function QuanlyHangHoa1_SukienThem(ByVal tenhang As System.String, ByVal quycach As System.String, ByVal giaban As System.Double, ByVal soluong As System.Int32) As System.Int32 Handles QuanlyHangHoa1.SukienThem
        Dim flag As Integer = 1
        Dim err As String = String.Empty
        err = BUS.BusHanghoa.Them(tenhang, quycach, giaban, soluong)
        If (err <> String.Empty) Then
            flag = 0
            MessageBox.Show(err)
        End If
        Return flag

    End Function

   
   
End Class